import { User } from '../constants';

export const initialState = {
  user: {
    id: 0,
    name: 'admin',
  },
  layout: { drawerOpen: false },
  menu: [],
};

export default function (state = initialState, { type, payload }) {
  const { user } = state;
  switch (type) {
    case User.ADD:
      return {
        user: {
          ...user,
          ...payload,
        },
      };
    default:
      break;
  }
  return state;
}
